package com.bingo.base;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Component;

/**
 * 发送单向消息
 */
@Component
public class OneWayProducer {

    @Autowired
    RocketMQTemplate rocketMQTemplate;

    public void send(String payload) {
        Message<String> message = MessageBuilder.withPayload(payload).build();
        rocketMQTemplate.sendOneWay("Base:springboot-oneway", message);
    }
}
